# This file is part of PulseAudio.
#
# Copyright 2004-2006 Lennart Poettering
# Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
# Copyright 2006 Diego Pettenò
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.

SUBDIRS = pulsecore pulse daemon modules utils tests

###################################
#       Extra directories         #
###################################

pulseincludedir=$(includedir)/pulse
pulsecoreincludedir=$(includedir)/pulsecore
pulseconfdir=$(sysconfdir)/pulse
pulselibexecdir=$(libexecdir)/pulse
xdgautostartdir=$(sysconfdir)/xdg/autostart
alsaprofilesetsdir=$(datadir)/pulseaudio/alsa-mixer/profile-sets
alsapathsdir=$(datadir)/pulseaudio/alsa-mixer/paths
dbuspolicydir=$(sysconfdir)/dbus-1/system.d

###################################
#            Defines              #
###################################

PA_BINARY=$(bindir)/pulseaudio$(EXEEXT)
if OS_IS_WIN32
PA_DEFAULT_CONFIG_DIR=%PULSE_ROOT%
else
PA_DEFAULT_CONFIG_DIR=$(pulseconfdir)
endif

###################################
#     Compiler/linker flags       #
###################################

AM_CFLAGS = \
	-I$(top_srcdir)/src \
	-I$(top_builddir)/src \
	-I$(top_srcdir)/src/modules \
	-I$(top_builddir)/src/modules \
	-I$(top_srcdir)/src/modules/rtp \
	-I$(top_builddir)/src/modules/rtp \
	-I$(top_srcdir)/src/modules/gconf \
	-I$(top_builddir)/src/modules/gconf \
	-I$(top_srcdir)/src/modules/bluetooth \
	-I$(top_builddir)/src/modules/bluetooth \
	-I$(top_srcdir)/src/modules/oss \
	-I$(top_builddir)/src/modules/oss \
	-I$(top_srcdir)/src/modules/alsa \
	-I$(top_builddir)/src/modules/alsa \
	-I$(top_srcdir)/src/modules/raop \
	-I$(top_builddir)/src/modules/raop \
	-I$(top_srcdir)/src/modules/x11 \
	-I$(top_builddir)/src/modules/x11 \
	-I$(top_srcdir)/src/modules/jack \
	-I$(top_builddir)/src/modules/jack \
	-I$(top_srcdir)/src/modules/echo-cancel \
	-I$(top_builddir)/src/modules/echo-cancel \
	$(PTHREAD_CFLAGS) -D_POSIX_PTHREAD_SEMANTICS \
	$(LIBSAMPLERATE_CFLAGS) \
	$(LIBSNDFILE_CFLAGS) \
	$(LIBSPEEX_CFLAGS) \
	-DPA_BUILDDIR=\"$(abs_builddir)\" \
	-DPA_DLSEARCHPATH=\"$(modlibexecdir)\" \
	-DPA_DEFAULT_CONFIG_DIR=\"$(PA_DEFAULT_CONFIG_DIR)\" \
	-DPA_BINARY=\"$(PA_BINARY)\" \
	-DPA_SYSTEM_RUNTIME_PATH=\"$(PA_SYSTEM_RUNTIME_PATH)\" \
	-DPA_SYSTEM_CONFIG_PATH=\"$(PA_SYSTEM_CONFIG_PATH)\" \
	-DPA_SYSTEM_STATE_PATH=\"$(PA_SYSTEM_STATE_PATH)\" \
	-DAO_REQUIRE_CAS \
	-DPULSE_LOCALEDIR=\"$(pulselocaledir)\" \
	-DPA_MACHINE_ID=\"$(localstatedir)/lib/dbus/machine-id\" \
        -DPA_ALSA_PATHS_DIR=\"$(alsapathsdir)\" \
        -DPA_ALSA_PROFILE_SETS_DIR=\"$(alsaprofilesetsdir)\"

AM_LIBADD = $(PTHREAD_LIBS) $(INTLLIBS)
AM_LDADD = $(PTHREAD_LIBS) $(INTLLIBS)
AM_LDFLAGS = $(NODELETE_LDFLAGS)

if STATIC_BINS
BINLDFLAGS = -static
endif

if OS_IS_WIN32
AM_LDFLAGS+=-Wl,--export-all-symbols
WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet
endif

FOREIGN_CFLAGS = -w
MODULE_LDFLAGS = -module -disable-static -avoid-version $(LDFLAGS_NOUNDEFINED)

###################################
#          Extra files            #
###################################

ALSA_PROFILES = \
		modules/alsa/mixer/profile-sets/default.conf \
		modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf \
		modules/alsa/mixer/profile-sets/native-instruments-audio4dj.conf \
		modules/alsa/mixer/profile-sets/native-instruments-audio8dj.conf \
		modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf \
		modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf

ALSA_PATHS = \
		modules/alsa/mixer/paths/analog-input-aux.conf \
		modules/alsa/mixer/paths/analog-input.conf \
		modules/alsa/mixer/paths/analog-input.conf.common \
		modules/alsa/mixer/paths/analog-input-fm.conf \
		modules/alsa/mixer/paths/analog-input-internal-mic.conf \
		modules/alsa/mixer/paths/analog-input-linein.conf \
		modules/alsa/mixer/paths/analog-input-mic.conf \
		modules/alsa/mixer/paths/analog-input-mic.conf.common \
		modules/alsa/mixer/paths/analog-input-mic-line.conf \
		modules/alsa/mixer/paths/analog-input-tvtuner.conf \
		modules/alsa/mixer/paths/analog-input-video.conf \
		modules/alsa/mixer/paths/analog-output.conf \
		modules/alsa/mixer/paths/analog-output-speaker.conf \
		modules/alsa/mixer/paths/analog-output.conf.common \
		modules/alsa/mixer/paths/analog-output-desktop-speaker.conf \
		modules/alsa/mixer/paths/analog-output-headphones.conf \
		modules/alsa/mixer/paths/analog-output-headphones-2.conf \
		modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf \
		modules/alsa/mixer/paths/analog-output-mono.conf

EXTRA_DIST = \
		pulse/client.conf.in \
		pulse/version.h.in \
		daemon/daemon.conf.in \
		daemon/default.pa.in \
		daemon/system.pa.in \
		daemon/default.pa.win32 \
		depmod.py \
		daemon/esdcompat.in \
		daemon/start-pulseaudio-x11.in \
		daemon/start-pulseaudio-kde.in \
		utils/padsp \
		modules/module-defs.h.m4 \
		daemon/pulseaudio.desktop.in \
		daemon/pulseaudio-kde.desktop.in \
		map-file \
		daemon/pulseaudio-system.conf \
		modules/echo-cancel/adrian-license.txt \
		modules/alsa/mixer/profile-sets/90-pulseaudio.rules \
		${ALSA_PROFILES} \
		${ALSA_PATHS}

pulseconf_DATA = \
		default.pa \
		system.pa \
		daemon.conf \
		client.conf

dbuspolicy_DATA = \
		daemon/pulseaudio-system.conf

if HAVE_X11
xdgautostart_in_files = \
		daemon/pulseaudio.desktop.in \
		daemon/pulseaudio-kde.desktop.in
endif
xdgautostart_DATA = $(xdgautostart_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@


BUILT_SOURCES = \
		pulse/version.h

###################################
#          Main daemon            #
###################################

bin_PROGRAMS = pulseaudio

pulseaudio_SOURCES = \
		daemon/caps.h daemon/caps.c \
		daemon/cmdline.c daemon/cmdline.h \
		daemon/cpulimit.c daemon/cpulimit.h \
		daemon/daemon-conf.c daemon/daemon-conf.h \
		daemon/dumpmodules.c daemon/dumpmodules.h \
		daemon/ltdl-bind-now.c daemon/ltdl-bind-now.h \
		daemon/main.c

pulseaudio_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(CAP_CFLAGS) $(DBUS_CFLAGS)
pulseaudio_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(LIBSNDFILE_LIBS) $(CAP_LIBS) $(DBUS_LIBS)
# This is needed because automake doesn't properly expand the foreach below
pulseaudio_DEPENDENCIES = libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la $(PREOPEN_LIBS)

if PREOPEN_MODS
PREOPEN_LIBS = $(PREOPEN_MODS)
else
PREOPEN_LIBS = $(modlibexec_LTLIBRARIES)
endif

if FORCE_PREOPEN
pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
else
pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
endif

###################################
#       Utility programs          #
###################################

bin_PROGRAMS += \
		pacat \
		pactl \
		pasuspender

if HAVE_AF_UNIX
bin_PROGRAMS += pacmd
endif

if HAVE_X11
bin_PROGRAMS += pax11publish
endif

if HAVE_AVAHI
bin_PROGRAMS += pabrowse
endif

bin_SCRIPTS = esdcompat start-pulseaudio-x11 start-pulseaudio-kde

pacat_SOURCES = utils/pacat.c
pacat_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(LIBSNDFILE_LIBS)
pacat_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS)
pacat_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

pactl_SOURCES = utils/pactl.c
pactl_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(LIBSNDFILE_LIBS)
pactl_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS)
pactl_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

pasuspender_SOURCES = utils/pasuspender.c
pasuspender_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
pasuspender_CFLAGS = $(AM_CFLAGS)
pasuspender_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

pacmd_SOURCES = utils/pacmd.c
pacmd_CFLAGS = $(AM_CFLAGS)
pacmd_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
pacmd_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

pax11publish_SOURCES = utils/pax11publish.c
pax11publish_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS)
pax11publish_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(X11_LIBS)
pax11publish_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

pabrowse_SOURCES = utils/pabrowse.c
pabrowse_LDADD = $(AM_LDADD) libpulse.la libpulse-browse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
pabrowse_CFLAGS = $(AM_CFLAGS)
pabrowse_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

###################################
#         Test programs           #
###################################

# missing: mcalign-test flist-test pacat-simple parec-simple sync-playback rtstutter stripnul interpol-test thread-test

TESTS = \
		mainloop-test \
		strlist-test \
		close-test \
		voltest \
		vector-test \
		memblockq-test \
		channelmap-test \
		thread-mainloop-test \
		utf8-test \
		get-binary-name-test \
		ipacl-test \
		hook-list-test \
		memblock-test \
		asyncq-test \
		asyncmsgq-test \
		queue-test \
		rtpoll-test \
		sig2str-test \
		resampler-test \
		smoother-test \
		mix-test \
		remix-test \
		envelope-test \
		proplist-test \
		lock-autospawn-test \
		prioq-test \
		sigbus-test \
		usergroup-test

TESTS_BINARIES = \
		mainloop-test \
		mcalign-test \
		pacat-simple \
		parec-simple \
		strlist-test \
		close-test \
		voltest \
		vector-test \
		memblockq-test \
		sync-playback \
		interpol-test \
		channelmap-test \
		thread-mainloop-test \
		utf8-test \
		get-binary-name-test \
		ipacl-test \
		hook-list-test \
		memblock-test \
		thread-test \
		flist-test \
		asyncq-test \
		asyncmsgq-test \
		queue-test \
		rtpoll-test \
		sig2str-test \
		resampler-test \
		smoother-test \
		mix-test \
		remix-test \
		envelope-test \
		proplist-test \
		rtstutter \
		stripnul \
		lock-autospawn-test \
		prioq-test \
		sigbus-test \
		usergroup-test

if HAVE_SIGXCPU
#TESTS += \
#		cpulimit-test \
#		cpulimit-test2
TESTS_BINARIES += \
		cpulimit-test \
		cpulimit-test2
endif

if HAVE_GLIB20
TESTS += \
		mainloop-test-glib
TESTS_BINARIES += \
		mainloop-test-glib
endif

if HAVE_GTK20
TESTS_BINARIES += \
		gtk-test
endif

if HAVE_ALSA
TESTS_BINARIES += \
		alsa-time-test
endif

if BUILD_TESTS_DEFAULT
noinst_PROGRAMS = $(TESTS_BINARIES)
else
check_PROGRAMS = $(TESTS_BINARIES)
endif

mainloop_test_SOURCES = tests/mainloop-test.c
mainloop_test_CFLAGS = $(AM_CFLAGS)
mainloop_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

thread_mainloop_test_SOURCES = tests/thread-mainloop-test.c
thread_mainloop_test_CFLAGS = $(AM_CFLAGS)
thread_mainloop_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
thread_mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

utf8_test_SOURCES = tests/utf8-test.c
utf8_test_CFLAGS = $(AM_CFLAGS)
utf8_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
utf8_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

get_binary_name_test_SOURCES = tests/get-binary-name-test.c
get_binary_name_test_CFLAGS = $(AM_CFLAGS)
get_binary_name_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
get_binary_name_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

ipacl_test_SOURCES = tests/ipacl-test.c
ipacl_test_CFLAGS = $(AM_CFLAGS)
ipacl_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
ipacl_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

hook_list_test_SOURCES = tests/hook-list-test.c
hook_list_test_CFLAGS = $(AM_CFLAGS)
hook_list_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
hook_list_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

memblock_test_SOURCES = tests/memblock-test.c
memblock_test_CFLAGS = $(AM_CFLAGS)
memblock_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
memblock_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

thread_test_SOURCES = tests/thread-test.c
thread_test_CFLAGS = $(AM_CFLAGS)
thread_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
thread_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

flist_test_SOURCES = tests/flist-test.c
flist_test_CFLAGS = $(AM_CFLAGS)
flist_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
flist_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

asyncq_test_SOURCES = tests/asyncq-test.c
asyncq_test_CFLAGS = $(AM_CFLAGS)
asyncq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
asyncq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

asyncmsgq_test_SOURCES = tests/asyncmsgq-test.c
asyncmsgq_test_CFLAGS = $(AM_CFLAGS)
asyncmsgq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
asyncmsgq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

queue_test_SOURCES = tests/queue-test.c
queue_test_CFLAGS = $(AM_CFLAGS)
queue_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
queue_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

rtpoll_test_SOURCES = tests/rtpoll-test.c
rtpoll_test_CFLAGS = $(AM_CFLAGS)
rtpoll_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
rtpoll_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

mcalign_test_SOURCES = tests/mcalign-test.c
mcalign_test_CFLAGS = $(AM_CFLAGS)
mcalign_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
mcalign_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

pacat_simple_SOURCES = tests/pacat-simple.c
pacat_simple_LDADD = $(AM_LDADD) libpulse.la libpulse-simple.la libpulsecommon-@PA_MAJORMINORMICRO@.la
pacat_simple_CFLAGS = $(AM_CFLAGS)
pacat_simple_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

parec_simple_SOURCES = tests/parec-simple.c
parec_simple_LDADD = $(AM_LDADD) libpulse.la libpulse-simple.la libpulsecommon-@PA_MAJORMINORMICRO@.la
parec_simple_CFLAGS = $(AM_CFLAGS)
parec_simple_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

strlist_test_SOURCES = tests/strlist-test.c
strlist_test_CFLAGS = $(AM_CFLAGS)
strlist_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
strlist_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

close_test_SOURCES = tests/close-test.c
close_test_CFLAGS = $(AM_CFLAGS)
close_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
close_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

voltest_SOURCES = tests/voltest.c
voltest_CFLAGS = $(AM_CFLAGS)
voltest_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
voltest_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

vector_test_SOURCES = tests/vector-test.c
vector_test_CFLAGS = $(AM_CFLAGS)
vector_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
vector_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

channelmap_test_SOURCES = tests/channelmap-test.c
channelmap_test_CFLAGS = $(AM_CFLAGS)
channelmap_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
channelmap_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

cpulimit_test_SOURCES = tests/cpulimit-test.c daemon/cpulimit.c daemon/cpulimit.h
cpulimit_test_CFLAGS = $(AM_CFLAGS)
cpulimit_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
cpulimit_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

cpulimit_test2_SOURCES = tests/cpulimit-test.c daemon/cpulimit.c daemon/cpulimit.h
cpulimit_test2_CFLAGS = $(AM_CFLAGS) -DTEST2
cpulimit_test2_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
cpulimit_test2_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

mainloop_test_glib_SOURCES = $(mainloop_test_SOURCES)
mainloop_test_glib_CFLAGS = $(mainloop_test_CFLAGS) $(GLIB20_CFLAGS) -DGLIB_MAIN_LOOP
mainloop_test_glib_LDADD = $(mainloop_test_LDADD) $(GLIB20_LIBS) libpulse-mainloop-glib.la
mainloop_test_glib_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

memblockq_test_SOURCES = tests/memblockq-test.c
memblockq_test_CFLAGS = $(AM_CFLAGS)
memblockq_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
memblockq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

sync_playback_SOURCES = tests/sync-playback.c
sync_playback_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
sync_playback_CFLAGS = $(AM_CFLAGS)
sync_playback_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

interpol_test_SOURCES = tests/interpol-test.c
interpol_test_LDADD = $(AM_LDADD) libpulse.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
interpol_test_CFLAGS = $(AM_CFLAGS)
interpol_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

sig2str_test_SOURCES = tests/sig2str-test.c
sig2str_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
sig2str_test_CFLAGS = $(AM_CFLAGS)
sig2str_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

resampler_test_SOURCES = tests/resampler-test.c
resampler_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
resampler_test_CFLAGS = $(AM_CFLAGS)
resampler_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

mix_test_SOURCES = tests/mix-test.c
mix_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
mix_test_CFLAGS = $(AM_CFLAGS)
mix_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

remix_test_SOURCES = tests/remix-test.c
remix_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
remix_test_CFLAGS = $(AM_CFLAGS)
remix_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

smoother_test_SOURCES = tests/smoother-test.c
smoother_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
smoother_test_CFLAGS = $(AM_CFLAGS)
smoother_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

envelope_test_SOURCES = tests/envelope-test.c
envelope_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
envelope_test_CFLAGS = $(AM_CFLAGS)
envelope_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

proplist_test_SOURCES = tests/proplist-test.c
proplist_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
proplist_test_CFLAGS = $(AM_CFLAGS)
proplist_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

rtstutter_SOURCES = tests/rtstutter.c
rtstutter_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
rtstutter_CFLAGS = $(AM_CFLAGS)
rtstutter_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

stripnul_SOURCES = tests/stripnul.c
stripnul_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
stripnul_CFLAGS = $(AM_CFLAGS)
stripnul_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

lock_autospawn_test_SOURCES = tests/lock-autospawn-test.c
lock_autospawn_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
lock_autospawn_test_CFLAGS = $(AM_CFLAGS)
lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

prioq_test_SOURCES = tests/prioq-test.c
prioq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
prioq_test_CFLAGS = $(AM_CFLAGS)
prioq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

sigbus_test_SOURCES = tests/sigbus-test.c
sigbus_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
sigbus_test_CFLAGS = $(AM_CFLAGS)
sigbus_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

gtk_test_SOURCES = tests/gtk-test.c
gtk_test_LDADD = $(AM_LDADD) libpulse.la libpulse-mainloop-glib.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
gtk_test_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
gtk_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(GTK20_LIBS)

alsa_time_test_SOURCES = tests/alsa-time-test.c
alsa_time_test_LDADD = $(AM_LDADD)
alsa_time_test_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)
alsa_time_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(ASOUNDLIB_LIBS)

usergroup_test_SOURCES = tests/usergroup-test.c
usergroup_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
usergroup_test_CFLAGS = $(AM_CFLAGS)
usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

###################################
#         Common library          #
###################################

lib_LTLIBRARIES = \
		libpulsecommon-@PA_MAJORMINORMICRO@.la

libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES = \
		pulse/client-conf.c pulse/client-conf.h \
		pulse/i18n.c pulse/i18n.h \
		pulse/fork-detect.c pulse/fork-detect.h \
		pulsecore/atomic.h \
		pulsecore/authkey.c pulsecore/authkey.h \
		pulsecore/conf-parser.c pulsecore/conf-parser.h \
		pulsecore/core-error.c pulsecore/core-error.h \
		pulsecore/core-rtclock.c pulsecore/core-rtclock.h \
		pulsecore/core-util.c pulsecore/core-util.h \
		pulsecore/creds.h \
		pulsecore/dynarray.c pulsecore/dynarray.h \
		pulsecore/endianmacros.h \
		pulsecore/flist.c pulsecore/flist.h \
		pulsecore/hashmap.c pulsecore/hashmap.h \
		pulsecore/idxset.c pulsecore/idxset.h \
		pulsecore/inet_ntop.c pulsecore/inet_ntop.h \
		pulsecore/inet_pton.c pulsecore/inet_pton.h \
		pulsecore/iochannel.c pulsecore/iochannel.h \
		pulsecore/ioline.c pulsecore/ioline.h \
		pulsecore/ipacl.h pulsecore/ipacl.c \
		pulsecore/llist.h \
		pulsecore/lock-autospawn.c pulsecore/lock-autospawn.h \
		pulsecore/log.c pulsecore/log.h \
		pulsecore/ratelimit.c pulsecore/ratelimit.h \
		pulsecore/macro.h pulsecore/vector.h \
		pulsecore/mcalign.c pulsecore/mcalign.h \
		pulsecore/memblock.c pulsecore/memblock.h \
		pulsecore/memblockq.c pulsecore/memblockq.h \
		pulsecore/memchunk.c pulsecore/memchunk.h \
		pulsecore/native-common.h \
		pulsecore/once.c pulsecore/once.h \
		pulsecore/packet.c pulsecore/packet.h \
		pulsecore/parseaddr.c pulsecore/parseaddr.h \
		pulsecore/pdispatch.c pulsecore/pdispatch.h \
		pulsecore/pid.c pulsecore/pid.h \
		pulsecore/pipe.c pulsecore/pipe.h \
		pulsecore/poll.c pulsecore/poll.h \
		pulsecore/prioq.c pulsecore/prioq.h \
		pulsecore/memtrap.c pulsecore/memtrap.h \
		pulsecore/aupdate.c pulsecore/aupdate.h \
		pulsecore/proplist-util.c pulsecore/proplist-util.h \
		pulsecore/pstream-util.c pulsecore/pstream-util.h \
		pulsecore/pstream.c pulsecore/pstream.h \
		pulsecore/queue.c pulsecore/queue.h \
		pulsecore/random.c pulsecore/random.h \
		pulsecore/refcnt.h \
		pulsecore/shm.c pulsecore/shm.h \
		pulsecore/bitset.c pulsecore/bitset.h \
		pulsecore/socket-client.c pulsecore/socket-client.h \
		pulsecore/socket-server.c pulsecore/socket-server.h \
		pulsecore/socket-util.c pulsecore/socket-util.h \
		pulsecore/strbuf.c pulsecore/strbuf.h \
		pulsecore/strlist.c pulsecore/strlist.h \
		pulsecore/tagstruct.c pulsecore/tagstruct.h \
		pulsecore/time-smoother.c pulsecore/time-smoother.h \
		pulsecore/tokenizer.c pulsecore/tokenizer.h \
		pulsecore/usergroup.c pulsecore/usergroup.h \
		pulsecore/sndfile-util.c pulsecore/sndfile-util.h \
		pulsecore/winsock.h

libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS = $(AM_CFLAGS)
libpulsecommon_@PA_MAJORMINORMICRO@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
libpulsecommon_@PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBWRAP_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) $(LIBSNDFILE_LIBS)

# proplist-util.h uses these header files, but not the library itself!
libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(GLIB20_CFLAGS) $(GTK20_CFLAGS)

## Please note that libpulsecommon implicitly also depends on<
## libpulse! i.e. we have a cyclic dependancy here. Which is intended
## since libpulse only includes stable, official APIs, while
## libpulsecommon only includes unofficial APIs.

if OS_IS_WIN32
libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += \
		pulsecore/mutex-win32.c pulsecore/mutex.h \
		pulsecore/thread-win32.c pulsecore/thread.h \
		pulsecore/semaphore-win32.c pulsecore/semaphore.h
else
libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += \
		pulsecore/mutex-posix.c pulsecore/mutex.h \
		pulsecore/thread-posix.c pulsecore/thread.h \
		pulsecore/semaphore-posix.c pulsecore/semaphore.h
endif

if HAVE_X11
libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/x11prop.c pulsecore/x11prop.h
libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(X11_CFLAGS)
libpulsecommon_@PA_MAJORMINORMICRO@_la_LDFLAGS += $(X11_LIBS)
endif

if HAVE_LIBASYNCNS
libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(LIBASYNCNS_CFLAGS)
libpulsecommon_@PA_MAJORMINORMICRO@_la_LIBADD += $(LIBASYNCNS_LIBS)
endif

if OS_IS_WIN32
libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/dllmain.c
endif

if HAVE_DBUS
libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += \
		pulsecore/dbus-util.c pulsecore/dbus-util.h \
		pulsecore/rtkit.c pulsecore/rtkit.h
libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(DBUS_CFLAGS)
libpulsecommon_@PA_MAJORMINORMICRO@_la_LIBADD += $(DBUS_LIBS)
endif

###################################
#         Client library          #
###################################

pulseinclude_HEADERS = \
		pulse/cdecl.h \
		pulse/channelmap.h \
		pulse/context.h \
		pulse/def.h \
		pulse/error.h \
		pulse/ext-device-manager.h \
		pulse/ext-stream-restore.h \
		pulse/gccmacro.h \
		pulse/introspect.h \
		pulse/mainloop-api.h \
		pulse/mainloop-signal.h \
		pulse/mainloop.h \
		pulse/operation.h \
		pulse/proplist.h \
		pulse/pulseaudio.h \
		pulse/rtclock.h \
		pulse/sample.h \
		pulse/scache.h \
		pulse/simple.h \
		pulse/stream.h \
		pulse/subscribe.h \
		pulse/thread-mainloop.h \
		pulse/timeval.h \
		pulse/utf8.h \
		pulse/util.h \
		pulse/version.h \
		pulse/volume.h \
		pulse/xmalloc.h

lib_LTLIBRARIES += \
		libpulse.la \
		libpulse-simple.la

if HAVE_AVAHI
pulseinclude_HEADERS += \
		pulse/browser.h

lib_LTLIBRARIES += \
		libpulse-browse.la
endif

if HAVE_GLIB20
pulseinclude_HEADERS += \
		pulse/glib-mainloop.h

lib_LTLIBRARIES += \
		libpulse-mainloop-glib.la
endif

# Public interface
libpulse_la_SOURCES = \
		pulse/cdecl.h \
		pulse/channelmap.c pulse/channelmap.h \
		pulse/context.c pulse/context.h \
		pulse/def.h \
		pulse/error.c pulse/error.h \
		pulse/ext-device-manager.c pulse/ext-device-manager.h \
		pulse/ext-stream-restore.c pulse/ext-stream-restore.h \
		pulse/gccmacro.h \
		pulse/internal.h \
		pulse/introspect.c pulse/introspect.h \
		pulse/mainloop-api.c pulse/mainloop-api.h \
		pulse/mainloop-signal.c pulse/mainloop-signal.h \
		pulse/mainloop.c pulse/mainloop.h \
		pulse/operation.c pulse/operation.h \
		pulse/proplist.c pulse/proplist.h \
		pulse/pulseaudio.h \
		pulse/rtclock.c pulse/rtclock.h \
		pulse/sample.c pulse/sample.h \
		pulse/scache.c pulse/scache.h \
		pulse/stream.c pulse/stream.h \
		pulse/subscribe.c pulse/subscribe.h \
		pulse/thread-mainloop.c pulse/thread-mainloop.h \
		pulse/timeval.c pulse/timeval.h \
		pulse/utf8.c pulse/utf8.h \
		pulse/util.c pulse/util.h \
		pulse/volume.c pulse/volume.h \
		pulse/xmalloc.c pulse/xmalloc.h

libpulse_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
libpulse_la_LIBADD = $(AM_LIBADD) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon-@PA_MAJORMINORMICRO@.la
libpulse_la_LDFLAGS = $(AM_LDFLAGS) $(VERSIONING_LDFLAGS) -version-info $(LIBPULSE_VERSION_INFO)

if HAVE_X11
libpulse_la_SOURCES += pulse/client-conf-x11.c pulse/client-conf-x11.h
libpulse_la_CFLAGS += $(X11_CFLAGS)
libpulse_la_LDFLAGS += $(X11_LIBS)
endif

libpulse_simple_la_SOURCES = pulse/simple.c pulse/simple.h
libpulse_simple_la_CFLAGS = $(AM_CFLAGS)
libpulse_simple_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
libpulse_simple_la_LDFLAGS = $(AM_LDFLAGS) $(VERSIONING_LDFLAGS) -version-info $(LIBPULSE_SIMPLE_VERSION_INFO)

libpulse_browse_la_SOURCES = pulse/browser.c pulse/browser.h pulsecore/avahi-wrap.c pulsecore/avahi-wrap.h
libpulse_browse_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)
libpulse_browse_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(AVAHI_LIBS)
libpulse_browse_la_LDFLAGS = $(AM_LDFLAGS) $(VERSIONING_LDFLAGS) -version-info $(LIBPULSE_BROWSE_VERSION_INFO)

libpulse_mainloop_glib_la_SOURCES = pulse/glib-mainloop.h pulse/glib-mainloop.c
libpulse_mainloop_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
libpulse_mainloop_glib_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(GLIB20_LIBS)
libpulse_mainloop_glib_la_LDFLAGS = $(AM_LDFLAGS) $(VERSIONING_LDFLAGS) -version-info $(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO)

###################################
#         OSS emulation           #
###################################

if HAVE_OSS_WRAPPER
lib_LTLIBRARIES += libpulsedsp.la
bin_SCRIPTS += utils/padsp
endif

libpulsedsp_la_SOURCES = utils/padsp.c
libpulsedsp_la_CFLAGS = $(AM_CFLAGS)
libpulsedsp_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
libpulsedsp_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version -disable-static

###################################
#      Daemon core library        #
###################################

lib_LTLIBRARIES += libpulsecore-@PA_MAJORMINORMICRO@.la

# Pure core stuff
libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES = \
		pulsecore/asyncmsgq.c pulsecore/asyncmsgq.h \
		pulsecore/asyncq.c pulsecore/asyncq.h \
		pulsecore/auth-cookie.c pulsecore/auth-cookie.h \
		pulsecore/cli-command.c pulsecore/cli-command.h \
		pulsecore/cli-text.c pulsecore/cli-text.h \
		pulsecore/client.c pulsecore/client.h \
		pulsecore/card.c pulsecore/card.h \
		pulsecore/core-scache.c pulsecore/core-scache.h \
		pulsecore/core-subscribe.c pulsecore/core-subscribe.h \
		pulsecore/core.c pulsecore/core.h \
		pulsecore/envelope.c pulsecore/envelope.h \
		pulsecore/fdsem.c pulsecore/fdsem.h \
		pulsecore/g711.c pulsecore/g711.h \
		pulsecore/hook-list.c pulsecore/hook-list.h \
		pulsecore/ltdl-helper.c pulsecore/ltdl-helper.h \
		pulsecore/modargs.c pulsecore/modargs.h \
		pulsecore/modinfo.c pulsecore/modinfo.h \
		pulsecore/module.c pulsecore/module.h \
		pulsecore/msgobject.c pulsecore/msgobject.h \
		pulsecore/namereg.c pulsecore/namereg.h \
		pulsecore/object.c pulsecore/object.h \
		pulsecore/play-memblockq.c pulsecore/play-memblockq.h \
		pulsecore/play-memchunk.c pulsecore/play-memchunk.h \
		pulsecore/remap.c pulsecore/remap.h \
		pulsecore/remap_mmx.c pulsecore/remap_sse.c \
		pulsecore/resampler.c pulsecore/resampler.h \
		pulsecore/rtpoll.c pulsecore/rtpoll.h \
		pulsecore/sample-util.c pulsecore/sample-util.h \
		pulsecore/cpu-arm.c pulsecore/cpu-arm.h \
		pulsecore/cpu-x86.c pulsecore/cpu-x86.h \
		pulsecore/svolume_c.c pulsecore/svolume_arm.c \
		pulsecore/svolume_mmx.c pulsecore/svolume_sse.c \
		pulsecore/sconv-s16be.c pulsecore/sconv-s16be.h \
		pulsecore/sconv-s16le.c pulsecore/sconv-s16le.h \
		pulsecore/sconv_sse.c \
		pulsecore/sconv.c pulsecore/sconv.h \
		pulsecore/shared.c pulsecore/shared.h \
		pulsecore/shm.c pulsecore/shm.h \
		pulsecore/sink-input.c pulsecore/sink-input.h \
		pulsecore/sink.c pulsecore/sink.h \
		pulsecore/sioman.c pulsecore/sioman.h \
		pulsecore/sound-file-stream.c pulsecore/sound-file-stream.h \
		pulsecore/sound-file.c pulsecore/sound-file.h \
		pulsecore/source-output.c pulsecore/source-output.h \
		pulsecore/source.c pulsecore/source.h \
		pulsecore/start-child.c pulsecore/start-child.h \
		pulsecore/thread-mq.c pulsecore/thread-mq.h \
		pulsecore/time-smoother.c pulsecore/time-smoother.h \
		pulsecore/database.h

libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(WINSOCK_CFLAGS)
libpulsecore_@PA_MAJORMINORMICRO@_la_LDFLAGS = -avoid-version
libpulsecore_@PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecore-foreign.la

if HAVE_X11
libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/x11wrap.c pulsecore/x11wrap.h
libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS += $(X11_CFLAGS)
libpulsecore_@PA_MAJORMINORMICRO@_la_LDFLAGS += $(X11_LIBS)
endif

if HAVE_DBUS
libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/dbus-shared.c pulsecore/dbus-shared.h
libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS += $(DBUS_CFLAGS)
libpulsecore_@PA_MAJORMINORMICRO@_la_LIBADD += $(DBUS_LIBS)
endif

if HAVE_GDBM
libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/database-gdbm.c
libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS += $(GDBM_CFLAGS)
libpulsecore_@PA_MAJORMINORMICRO@_la_LIBADD += $(GDBM_LIBS)
endif

if HAVE_TDB
libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/database-tdb.c
libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS += $(TDB_CFLAGS)
libpulsecore_@PA_MAJORMINORMICRO@_la_LIBADD += $(TDB_LIBS)
endif

if HAVE_SIMPLEDB
libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/database-simple.c
endif

# We split the foreign code off to not be annoyed by warnings we don't care about
noinst_LTLIBRARIES = libpulsecore-foreign.la

libpulsecore_foreign_la_SOURCES = \
		pulsecore/ffmpeg/resample2.c pulsecore/ffmpeg/avcodec.h pulsecore/ffmpeg/dsputil.h

libpulsecore_foreign_la_CFLAGS = $(AM_CFLAGS) $(FOREIGN_CFLAGS)

###################################
#   Plug-in support libraries     #
###################################

### Warning! Due to an obscure bug in libtool/automake it is required
### that the libraries in modlibexec_LTLIBRARIES are specified in-order,
### i.e. libraries near the end of the list depend on libraries near
### the head, and not the other way!

modlibexec_LTLIBRARIES = \
		libcli.la \
		libprotocol-cli.la \
		libprotocol-simple.la \
		libprotocol-http.la \
		libprotocol-native.la \
		libprotocol-esound.la

# We need to emulate sendmsg/recvmsg to support this on Win32
if !OS_IS_WIN32
modlibexec_LTLIBRARIES += \
		librtp.la
endif

if HAVE_AVAHI
modlibexec_LTLIBRARIES += \
		libavahi-wrap.la
endif

libprotocol_simple_la_SOURCES = pulsecore/protocol-simple.c pulsecore/protocol-simple.h
libprotocol_simple_la_LDFLAGS = -avoid-version
libprotocol_simple_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

libcli_la_SOURCES = pulsecore/cli.c pulsecore/cli.h
libcli_la_LDFLAGS = -avoid-version
libcli_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

libprotocol_cli_la_SOURCES = pulsecore/protocol-cli.c pulsecore/protocol-cli.h
libprotocol_cli_la_LDFLAGS = -avoid-version
libprotocol_cli_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la libcli.la

libprotocol_http_la_SOURCES = pulsecore/protocol-http.c pulsecore/protocol-http.h pulsecore/mime-type.c pulsecore/mime-type.h
libprotocol_http_la_LDFLAGS = -avoid-version
libprotocol_http_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

libprotocol_native_la_SOURCES = pulsecore/protocol-native.c pulsecore/protocol-native.h pulsecore/native-common.h
libprotocol_native_la_LDFLAGS = -avoid-version
libprotocol_native_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

libprotocol_esound_la_SOURCES = pulsecore/protocol-esound.c pulsecore/protocol-esound.h pulsecore/esound.h
libprotocol_esound_la_LDFLAGS = -avoid-version
libprotocol_esound_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

librtp_la_SOURCES = \
		modules/rtp/rtp.c modules/rtp/rtp.h \
		modules/rtp/sdp.c modules/rtp/sdp.h \
		modules/rtp/sap.c modules/rtp/sap.h \
		modules/rtp/rtsp_client.c modules/rtp/rtsp_client.h \
		modules/rtp/headerlist.c modules/rtp/headerlist.h
librtp_la_LDFLAGS = -avoid-version
librtp_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

libraop_la_SOURCES = \
        modules/raop/raop_client.c modules/raop/raop_client.h \
        modules/raop/base64.c modules/raop/base64.h
libraop_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS)
libraop_la_LDFLAGS = -avoid-version
libraop_la_LIBADD = $(AM_LIBADD) $(OPENSSL_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la librtp.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# Avahi
libavahi_wrap_la_SOURCES = pulsecore/avahi-wrap.c pulsecore/avahi-wrap.h
libavahi_wrap_la_LDFLAGS = -avoid-version
libavahi_wrap_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)
libavahi_wrap_la_LIBADD = $(AM_LIBADD) $(AVAHI_CFLAGS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

###################################
#        Plug-in libraries        #
###################################

if HAVE_DBUS
# Serveral module (e.g. libalsa-util.la)
modlibexec_LTLIBRARIES += \
		module-console-kit.la
endif

modlibexec_LTLIBRARIES += \
		module-cli.la \
		module-cli-protocol-tcp.la \
		module-simple-protocol-tcp.la \
		module-null-sink.la \
		module-sine-source.la \
		module-detect.la \
		module-volume-restore.la \
		module-device-manager.la \
		module-device-restore.la \
		module-stream-restore.la \
		module-card-restore.la \
		module-default-device-restore.la \
		module-always-sink.la \
		module-rescue-streams.la \
		module-intended-roles.la \
		module-suspend-on-idle.la \
		module-echo-cancel.la \
		module-http-protocol-tcp.la \
		module-sine.la \
		module-native-protocol-tcp.la \
		module-native-protocol-fd.la \
		module-esound-protocol-tcp.la \
		module-combine.la \
		module-remap-sink.la \
		module-ladspa-sink.la \
		module-esound-sink.la \
		module-tunnel-sink.la \
		module-tunnel-source.la \
		module-position-event-sounds.la \
		module-augment-properties.la \
		module-cork-music-on-phone.la \
		module-loopback.la

# See comment at librtp.la above
if !OS_IS_WIN32
modlibexec_LTLIBRARIES += \
		module-rtp-send.la \
		module-rtp-recv.la
endif

if HAVE_AF_UNIX
modlibexec_LTLIBRARIES += \
		module-cli-protocol-unix.la \
		module-simple-protocol-unix.la \
		module-http-protocol-unix.la \
		module-native-protocol-unix.la \
		module-esound-protocol-unix.la
endif

if HAVE_MKFIFO
modlibexec_LTLIBRARIES += \
		module-pipe-sink.la \
		module-pipe-source.la
endif

if !OS_IS_WIN32
modlibexec_LTLIBRARIES += \
		module-esound-compat-spawnfd.la \
		module-esound-compat-spawnpid.la
endif

if HAVE_REGEX
modlibexec_LTLIBRARIES += \
		module-match.la
endif

if HAVE_X11
modlibexec_LTLIBRARIES += \
		module-x11-bell.la \
		module-x11-publish.la \
		module-x11-xsmp.la \
		module-x11-cork-request.la
endif

if HAVE_OSS_OUTPUT
modlibexec_LTLIBRARIES += \
		liboss-util.la \
		module-oss.la
endif

pulselibexec_PROGRAMS =

if HAVE_ALSA
modlibexec_LTLIBRARIES += \
		libalsa-util.la \
		module-alsa-sink.la \
		module-alsa-source.la \
		module-alsa-card.la

alsaprofilesets_DATA = ${ALSA_PROFILES}

if HAVE_UDEV
udevrules_DATA = \
		modules/alsa/mixer/profile-sets/90-pulseaudio.rules
endif

alsapaths_DATA = ${ALSA_PATHS}

endif

if HAVE_SOLARIS
modlibexec_LTLIBRARIES += \
		module-solaris.la
endif

if HAVE_AVAHI
modlibexec_LTLIBRARIES += \
		module-zeroconf-publish.la \
		module-zeroconf-discover.la
endif

if HAVE_LIRC
modlibexec_LTLIBRARIES += \
		module-lirc.la
endif

if HAVE_EVDEV
modlibexec_LTLIBRARIES += \
		module-mmkbd-evdev.la
endif

if HAVE_JACK
modlibexec_LTLIBRARIES += \
		module-jack-sink.la \
		module-jack-source.la

if HAVE_DBUS
modlibexec_LTLIBRARIES += \
		module-jackdbus-detect.la
endif

endif

if HAVE_GCONF
modlibexec_LTLIBRARIES += \
		module-gconf.la

pulselibexec_PROGRAMS += \
		gconf-helper
endif

#if OS_IS_WIN32
#modlibexec_LTLIBRARIES += \
#		module-waveout.la
#endif

if HAVE_HAL
modlibexec_LTLIBRARIES += \
		module-hal-detect.la
endif

if HAVE_HAL_COMPAT
modlibexec_LTLIBRARIES += \
		module-hal-detect.la
endif

if HAVE_UDEV
modlibexec_LTLIBRARIES += \
		module-udev-detect.la
endif

if HAVE_DBUS
modlibexec_LTLIBRARIES += \
		module-rygel-media-server.la
endif

if HAVE_BLUEZ
modlibexec_LTLIBRARIES += \
		libbluetooth-util.la \
		module-bluetooth-proximity.la \
		module-bluetooth-discover.la \
		libbluetooth-ipc.la \
		libbluetooth-sbc.la \
		module-bluetooth-device.la

pulselibexec_PROGRAMS += \
		proximity-helper
endif

if HAVE_OPENSSL
modlibexec_LTLIBRARIES += \
		libraop.la \
		module-raop-sink.la
if HAVE_AVAHI
modlibexec_LTLIBRARIES += \
		module-raop-discover.la
endif
endif

# These are generated by an M4 script
SYMDEF_FILES = \
		modules/module-cli-symdef.h \
		modules/module-cli-protocol-tcp-symdef.h \
		modules/module-cli-protocol-unix-symdef.h \
		modules/module-pipe-sink-symdef.h \
		modules/module-pipe-source-symdef.h \
		modules/module-simple-protocol-tcp-symdef.h \
		modules/module-simple-protocol-unix-symdef.h \
		modules/module-esound-protocol-tcp-symdef.h \
		modules/module-esound-protocol-unix-symdef.h \
		modules/module-native-protocol-tcp-symdef.h \
		modules/module-native-protocol-unix-symdef.h \
		modules/module-native-protocol-fd-symdef.h \
		modules/module-sine-symdef.h \
		modules/module-combine-symdef.h \
		modules/module-remap-sink-symdef.h \
		modules/module-ladspa-sink-symdef.h \
		modules/module-esound-compat-spawnfd-symdef.h \
		modules/module-esound-compat-spawnpid-symdef.h \
		modules/module-match-symdef.h \
		modules/module-tunnel-sink-symdef.h \
		modules/module-tunnel-source-symdef.h \
		modules/module-null-sink-symdef.h \
		modules/module-sine-source-symdef.h \
		modules/module-esound-sink-symdef.h \
		modules/module-zeroconf-publish-symdef.h \
		modules/module-zeroconf-discover-symdef.h \
		modules/module-lirc-symdef.h \
		modules/module-mmkbd-evdev-symdef.h \
		modules/module-http-protocol-tcp-symdef.h \
		modules/module-http-protocol-unix-symdef.h \
		modules/module-rygel-media-server-symdef.h \
		modules/x11/module-x11-bell-symdef.h \
		modules/x11/module-x11-publish-symdef.h \
		modules/x11/module-x11-xsmp-symdef.h \
		modules/x11/module-x11-cork-request-symdef.h \
		modules/oss/module-oss-symdef.h \
		modules/alsa/module-alsa-sink-symdef.h \
		modules/alsa/module-alsa-source-symdef.h \
		modules/alsa/module-alsa-card-symdef.h \
		modules/module-solaris-symdef.h \
		modules/module-waveout-symdef.h \
		modules/module-detect-symdef.h \
		modules/rtp/module-rtp-send-symdef.h \
		modules/rtp/module-rtp-recv-symdef.h \
		modules/jack/module-jackdbus-detect-symdef.h \
		modules/jack/module-jack-sink-symdef.h \
		modules/jack/module-jack-source-symdef.h \
		modules/module-volume-restore-symdef.h \
		modules/module-device-manager-symdef.h \
		modules/module-device-restore-symdef.h \
		modules/module-stream-restore-symdef.h \
		modules/module-card-restore-symdef.h \
		modules/module-default-device-restore-symdef.h \
		modules/module-always-sink-symdef.h \
		modules/module-rescue-streams-symdef.h \
		modules/module-intended-roles-symdef.h \
		modules/module-suspend-on-idle-symdef.h \
		modules/echo-cancel/module-echo-cancel-symdef.h \
		modules/module-hal-detect-symdef.h \
		modules/module-udev-detect-symdef.h \
		modules/bluetooth/module-bluetooth-proximity-symdef.h \
		modules/bluetooth/module-bluetooth-discover-symdef.h \
		modules/bluetooth/module-bluetooth-device-symdef.h \
		modules/raop/module-raop-sink-symdef.h \
		modules/raop/module-raop-discover-symdef.h \
		modules/gconf/module-gconf-symdef.h \
		modules/module-position-event-sounds-symdef.h \
		modules/module-augment-properties-symdef.h \
		modules/module-cork-music-on-phone-symdef.h \
		modules/module-console-kit-symdef.h \
		modules/module-loopback-symdef.h

EXTRA_DIST += $(SYMDEF_FILES)
BUILT_SOURCES += $(SYMDEF_FILES)

$(SYMDEF_FILES): modules/module-defs.h.m4
	$(MKDIR_P) $(dir $@)
	$(M4) -Dfname="$@" $< > $@

# Simple protocol

module_simple_protocol_tcp_la_SOURCES = modules/module-protocol-stub.c
module_simple_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
module_simple_protocol_tcp_la_LDFLAGS = $(MODULE_LDFLAGS)
module_simple_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-simple.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_simple_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
module_simple_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
module_simple_protocol_unix_la_LDFLAGS = $(MODULE_LDFLAGS)
module_simple_protocol_unix_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-simple.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# CLI protocol

module_cli_la_SOURCES = modules/module-cli.c
module_cli_la_LDFLAGS = $(MODULE_LDFLAGS)
module_cli_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libcli.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_cli_protocol_tcp_la_SOURCES = modules/module-protocol-stub.c
module_cli_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
module_cli_protocol_tcp_la_LDFLAGS = $(MODULE_LDFLAGS)
module_cli_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-cli.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_cli_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
module_cli_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
module_cli_protocol_unix_la_LDFLAGS = $(MODULE_LDFLAGS)
module_cli_protocol_unix_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-cli.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# HTTP protocol

module_http_protocol_tcp_la_SOURCES = modules/module-protocol-stub.c
module_http_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_HTTP $(AM_CFLAGS)
module_http_protocol_tcp_la_LDFLAGS = $(MODULE_LDFLAGS)
module_http_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-http.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_http_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
module_http_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_HTTP $(AM_CFLAGS)
module_http_protocol_unix_la_LDFLAGS = $(MODULE_LDFLAGS)
module_http_protocol_unix_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-http.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# Native protocol

module_native_protocol_tcp_la_SOURCES = modules/module-protocol-stub.c
module_native_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
module_native_protocol_tcp_la_LDFLAGS = $(MODULE_LDFLAGS)
module_native_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-native.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_native_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
module_native_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
module_native_protocol_unix_la_LDFLAGS = $(MODULE_LDFLAGS)
module_native_protocol_unix_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-native.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_native_protocol_fd_la_SOURCES = modules/module-native-protocol-fd.c
module_native_protocol_fd_la_CFLAGS = $(AM_CFLAGS)
module_native_protocol_fd_la_LDFLAGS = $(MODULE_LDFLAGS)
module_native_protocol_fd_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-native.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# EsounD protocol

module_esound_protocol_tcp_la_SOURCES = modules/module-protocol-stub.c
module_esound_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
module_esound_protocol_tcp_la_LDFLAGS = $(MODULE_LDFLAGS)
module_esound_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-esound.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_esound_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
module_esound_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
module_esound_protocol_unix_la_LDFLAGS = $(MODULE_LDFLAGS)
module_esound_protocol_unix_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libprotocol-esound.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_esound_compat_spawnfd_la_SOURCES = modules/module-esound-compat-spawnfd.c
module_esound_compat_spawnfd_la_LDFLAGS = $(MODULE_LDFLAGS)
module_esound_compat_spawnfd_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_esound_compat_spawnpid_la_SOURCES = modules/module-esound-compat-spawnpid.c
module_esound_compat_spawnpid_la_LDFLAGS = $(MODULE_LDFLAGS)
module_esound_compat_spawnpid_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_esound_sink_la_SOURCES = modules/module-esound-sink.c
module_esound_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_esound_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# Pipes

module_pipe_sink_la_SOURCES = modules/module-pipe-sink.c
module_pipe_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_pipe_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_pipe_source_la_SOURCES = modules/module-pipe-source.c
module_pipe_source_la_LDFLAGS = $(MODULE_LDFLAGS)
module_pipe_source_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# Fake sources/sinks

module_sine_la_SOURCES = modules/module-sine.c
module_sine_la_LDFLAGS = $(MODULE_LDFLAGS)
module_sine_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_null_sink_la_SOURCES = modules/module-null-sink.c
module_null_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_null_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_sine_source_la_SOURCES = modules/module-sine-source.c
module_sine_source_la_LDFLAGS = -module -avoid-version
module_sine_source_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# Couplings

module_combine_la_SOURCES = modules/module-combine.c
module_combine_la_LDFLAGS = $(MODULE_LDFLAGS)
module_combine_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_remap_sink_la_SOURCES = modules/module-remap-sink.c
module_remap_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_remap_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_ladspa_sink_la_SOURCES = modules/module-ladspa-sink.c modules/ladspa.h
module_ladspa_sink_la_CFLAGS = -DLADSPA_PATH=\"$(libdir)/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/local/lib64/ladspa:/usr/lib64/ladspa\" $(AM_CFLAGS)
module_ladspa_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_ladspa_sink_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_match_la_SOURCES = modules/module-match.c
module_match_la_LDFLAGS = $(MODULE_LDFLAGS)
module_match_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_tunnel_sink_la_SOURCES = modules/module-tunnel.c
module_tunnel_sink_la_CFLAGS = -DTUNNEL_SINK=1 $(AM_CFLAGS)
module_tunnel_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_tunnel_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_tunnel_source_la_SOURCES = modules/module-tunnel.c
module_tunnel_source_la_LDFLAGS = $(MODULE_LDFLAGS)
module_tunnel_source_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_loopback_la_SOURCES = modules/module-loopback.c
module_loopback_la_LDFLAGS = $(MODULE_LDFLAGS)
module_loopback_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# X11

module_x11_bell_la_SOURCES = modules/x11/module-x11-bell.c
module_x11_bell_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS)
module_x11_bell_la_LDFLAGS = $(MODULE_LDFLAGS)
module_x11_bell_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_x11_publish_la_SOURCES = modules/x11/module-x11-publish.c
module_x11_publish_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS)
module_x11_publish_la_LDFLAGS = $(MODULE_LDFLAGS)
module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_x11_xsmp_la_SOURCES = modules/x11/module-x11-xsmp.c
module_x11_xsmp_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS)
module_x11_xsmp_la_LDFLAGS = $(MODULE_LDFLAGS)
module_x11_xsmp_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_x11_cork_request_la_SOURCES = modules/x11/module-x11-cork-request.c
module_x11_cork_request_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS)
module_x11_cork_request_la_LDFLAGS = $(MODULE_LDFLAGS)
module_x11_cork_request_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# OSS

liboss_util_la_SOURCES = modules/oss/oss-util.c modules/oss/oss-util.h
liboss_util_la_LDFLAGS = -avoid-version
liboss_util_la_LIBADD = libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_oss_la_SOURCES = modules/oss/module-oss.c
module_oss_la_LDFLAGS = $(MODULE_LDFLAGS)
module_oss_la_LIBADD = $(AM_LIBADD) liboss-util.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# ALSA

libalsa_util_la_SOURCES = modules/alsa/alsa-util.c modules/alsa/alsa-util.h modules/alsa/alsa-mixer.c modules/alsa/alsa-mixer.h modules/alsa/alsa-sink.c modules/alsa/alsa-sink.h modules/alsa/alsa-source.c modules/alsa/alsa-source.h modules/reserve-wrap.c modules/reserve-wrap.h
libalsa_util_la_LDFLAGS = -avoid-version
libalsa_util_la_LIBADD = $(AM_LIBADD) $(ASOUNDLIB_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
libalsa_util_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)

if HAVE_HAL
libalsa_util_la_SOURCES += modules/hal-util.h modules/hal-util.c
libalsa_util_la_LIBADD += $(HAL_LIBS)
libalsa_util_la_CFLAGS += $(HAL_CFLAGS)
endif

if HAVE_UDEV
libalsa_util_la_SOURCES += modules/udev-util.h modules/udev-util.c
libalsa_util_la_LIBADD += $(UDEV_LIBS)
libalsa_util_la_CFLAGS += $(UDEV_CFLAGS)
endif

if HAVE_DBUS
libalsa_util_la_SOURCES += modules/reserve.h modules/reserve.c modules/reserve-monitor.h modules/reserve-monitor.c
libalsa_util_la_LIBADD += $(DBUS_LIBS)
libalsa_util_la_CFLAGS += $(DBUS_CFLAGS)
endif

module_alsa_sink_la_SOURCES = modules/alsa/module-alsa-sink.c
module_alsa_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_alsa_sink_la_LIBADD = $(AM_LIBADD) $(ASOUNDLIB_LIBS) libalsa-util.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_alsa_sink_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)

module_alsa_source_la_SOURCES = modules/alsa/module-alsa-source.c
module_alsa_source_la_LDFLAGS = $(MODULE_LDFLAGS)
module_alsa_source_la_LIBADD = $(AM_LIBADD) $(ASOUNDLIB_LIBS) libalsa-util.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_alsa_source_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)

module_alsa_card_la_SOURCES = modules/alsa/module-alsa-card.c
module_alsa_card_la_LDFLAGS = $(MODULE_LDFLAGS)
module_alsa_card_la_LIBADD = $(AM_LIBADD) $(ASOUNDLIB_LIBS) libalsa-util.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_alsa_card_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)

# Solaris

module_solaris_la_SOURCES = modules/module-solaris.c
module_solaris_la_LDFLAGS = $(MODULE_LDFLAGS)
module_solaris_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

# Avahi

module_zeroconf_publish_la_SOURCES = modules/module-zeroconf-publish.c
module_zeroconf_publish_la_LDFLAGS = $(MODULE_LDFLAGS)
module_zeroconf_publish_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_zeroconf_publish_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)

module_zeroconf_discover_la_SOURCES = modules/module-zeroconf-discover.c
module_zeroconf_discover_la_LDFLAGS = $(MODULE_LDFLAGS)
module_zeroconf_discover_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_zeroconf_discover_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)

# LIRC

module_lirc_la_SOURCES = modules/module-lirc.c
module_lirc_la_LDFLAGS = $(MODULE_LDFLAGS)
module_lirc_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la $(LIRC_LIBS)
module_lirc_la_CFLAGS = $(AM_CFLAGS) $(LIRC_CFLAGS)

# Linux evdev

module_mmkbd_evdev_la_SOURCES = modules/module-mmkbd-evdev.c
module_mmkbd_evdev_la_LDFLAGS = $(MODULE_LDFLAGS)
module_mmkbd_evdev_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_mmkbd_evdev_la_CFLAGS = $(AM_CFLAGS)

# Windows waveout

#module_waveout_la_SOURCES = modules/module-waveout.c
#module_waveout_la_LDFLAGS = $(MODULE_LDFLAGS)
#module_waveout_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la -lwinmm libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
#module_waveout_la_CFLAGS = $(AM_CFLAGS)

# Hardware autodetection module
module_detect_la_SOURCES = modules/module-detect.c
module_detect_la_LDFLAGS = $(MODULE_LDFLAGS)
module_detect_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_detect_la_CFLAGS = $(AM_CFLAGS)

# Volume restore module
module_volume_restore_la_SOURCES = modules/module-volume-restore.c
module_volume_restore_la_LDFLAGS = $(MODULE_LDFLAGS)
module_volume_restore_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_volume_restore_la_CFLAGS = $(AM_CFLAGS)

# Position event sounds in space
module_position_event_sounds_la_SOURCES = modules/module-position-event-sounds.c
module_position_event_sounds_la_LDFLAGS = $(MODULE_LDFLAGS)
module_position_event_sounds_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_position_event_sounds_la_CFLAGS = $(AM_CFLAGS)

# Augment properties from XDG .desktop files
module_augment_properties_la_SOURCES = modules/module-augment-properties.c
module_augment_properties_la_LDFLAGS = $(MODULE_LDFLAGS)
module_augment_properties_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
#module_augment_properties_la_CFLAGS = $(AM_CFLAGS) -DDESKTOPFILEDIR=\"$(datadir)/applications\"
module_augment_properties_la_CFLAGS = $(AM_CFLAGS) -DDESKTOPFILEDIR=\"/usr/share/applications\"

# Cork music streams while a phone stream is active
module_cork_music_on_phone_la_SOURCES = modules/module-cork-music-on-phone.c
module_cork_music_on_phone_la_LDFLAGS = $(MODULE_LDFLAGS)
module_cork_music_on_phone_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_cork_music_on_phone_la_CFLAGS = $(AM_CFLAGS)

# Device description restore module
module_device_manager_la_SOURCES = modules/module-device-manager.c
module_device_manager_la_LDFLAGS = $(MODULE_LDFLAGS)
module_device_manager_la_LIBADD = $(AM_LIBADD) libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_device_manager_la_CFLAGS = $(AM_CFLAGS)

# Device volume/muted restore module
module_device_restore_la_SOURCES = modules/module-device-restore.c
module_device_restore_la_LDFLAGS = $(MODULE_LDFLAGS)
module_device_restore_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_device_restore_la_CFLAGS = $(AM_CFLAGS)

# Stream volume/muted/device restore module
module_stream_restore_la_SOURCES = modules/module-stream-restore.c
module_stream_restore_la_LDFLAGS = $(MODULE_LDFLAGS)
module_stream_restore_la_LIBADD = $(AM_LIBADD) libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_stream_restore_la_CFLAGS = $(AM_CFLAGS)

# Card profile restore module
module_card_restore_la_SOURCES = modules/module-card-restore.c
module_card_restore_la_LDFLAGS = $(MODULE_LDFLAGS)
module_card_restore_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_card_restore_la_CFLAGS = $(AM_CFLAGS)

# Default sink/source restore module
module_default_device_restore_la_SOURCES = modules/module-default-device-restore.c
module_default_device_restore_la_LDFLAGS = $(MODULE_LDFLAGS)
module_default_device_restore_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_default_device_restore_la_CFLAGS = $(AM_CFLAGS)

# Always Sink module
module_always_sink_la_SOURCES = modules/module-always-sink.c
module_always_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_always_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_always_sink_la_CFLAGS = $(AM_CFLAGS)

# Rescue streams module
module_rescue_streams_la_SOURCES = modules/module-rescue-streams.c
module_rescue_streams_la_LDFLAGS = $(MODULE_LDFLAGS)
module_rescue_streams_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_rescue_streams_la_CFLAGS = $(AM_CFLAGS)

# Automatically move streams to devices that are intended for their roles
module_intended_roles_la_SOURCES = modules/module-intended-roles.c
module_intended_roles_la_LDFLAGS = $(MODULE_LDFLAGS)
module_intended_roles_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_intended_roles_la_CFLAGS = $(AM_CFLAGS)

# Suspend-on-idle module
module_suspend_on_idle_la_SOURCES = modules/module-suspend-on-idle.c
module_suspend_on_idle_la_LDFLAGS = $(MODULE_LDFLAGS)
module_suspend_on_idle_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_suspend_on_idle_la_CFLAGS = $(AM_CFLAGS)

# echo-cancel module
module_echo_cancel_la_SOURCES = modules/echo-cancel/module-echo-cancel.c modules/echo-cancel/echo-cancel.h \
				modules/echo-cancel/speex.c \
				modules/echo-cancel/adrian-aec.c modules/echo-cancel/adrian-aec.h \
				modules/echo-cancel/adrian.c modules/echo-cancel/adrian.h
module_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
module_echo_cancel_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la $(LIBSPEEX_LIBS)
module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(LIBSPEEX_CFLAGS)

# RTP modules
module_rtp_send_la_SOURCES = modules/rtp/module-rtp-send.c
module_rtp_send_la_LDFLAGS = $(MODULE_LDFLAGS)
module_rtp_send_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la librtp.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_rtp_send_la_CFLAGS = $(AM_CFLAGS)

module_rtp_recv_la_SOURCES = modules/rtp/module-rtp-recv.c
module_rtp_recv_la_LDFLAGS = $(MODULE_LDFLAGS)
module_rtp_recv_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la librtp.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_rtp_recv_la_CFLAGS = $(AM_CFLAGS)

# JACK

module_jackdbus_detect_la_SOURCES = modules/jack/module-jackdbus-detect.c
module_jackdbus_detect_la_LDFLAGS = $(MODULE_LDFLAGS)
module_jackdbus_detect_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la $(JACK_LIBS) libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_jackdbus_detect_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(JACK_CFLAGS)

module_jack_sink_la_SOURCES = modules/jack/module-jack-sink.c
module_jack_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_jack_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la $(JACK_LIBS) libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_jack_sink_la_CFLAGS = $(AM_CFLAGS) $(JACK_CFLAGS)

module_jack_source_la_SOURCES = modules/jack/module-jack-source.c
module_jack_source_la_LDFLAGS = $(MODULE_LDFLAGS)
module_jack_source_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la $(JACK_LIBS) libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_jack_source_la_CFLAGS = $(AM_CFLAGS) $(JACK_CFLAGS)

if HAVE_HAL_COMPAT
module_hal_detect_la_SOURCES = modules/module-hal-detect-compat.c
module_hal_detect_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_hal_detect_la_CFLAGS = $(AM_CFLAGS)
else
module_hal_detect_la_SOURCES = modules/module-hal-detect.c
module_hal_detect_la_LIBADD = $(AM_LIBADD) $(HAL_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_hal_detect_la_CFLAGS = $(AM_CFLAGS) $(HAL_CFLAGS)
endif
module_hal_detect_la_LDFLAGS = $(MODULE_LDFLAGS)

module_udev_detect_la_SOURCES = modules/module-udev-detect.c
module_udev_detect_la_LDFLAGS = $(MODULE_LDFLAGS)
module_udev_detect_la_LIBADD = $(AM_LIBADD) $(UDEV_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_udev_detect_la_CFLAGS = $(AM_CFLAGS) $(UDEV_CFLAGS)

module_console_kit_la_SOURCES = modules/module-console-kit.c
module_console_kit_la_LDFLAGS = $(MODULE_LDFLAGS)
module_console_kit_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_console_kit_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)

# GConf support
module_gconf_la_SOURCES = modules/gconf/module-gconf.c
module_gconf_la_LDFLAGS = $(MODULE_LDFLAGS)
module_gconf_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_gconf_la_CFLAGS = $(AM_CFLAGS) -DPA_GCONF_HELPER=\"$(pulselibexecdir)/gconf-helper\"

gconf_helper_SOURCES = modules/gconf/gconf-helper.c
gconf_helper_LDADD = $(AM_LDADD) $(GCONF_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
gconf_helper_CFLAGS = $(AM_CFLAGS) $(GCONF_CFLAGS)
gconf_helper_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

# Bluetooth proximity
module_bluetooth_proximity_la_SOURCES = modules/bluetooth/module-bluetooth-proximity.c
module_bluetooth_proximity_la_LDFLAGS = $(MODULE_LDFLAGS)
module_bluetooth_proximity_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_bluetooth_proximity_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) -DPA_BT_PROXIMITY_HELPER=\"$(pulselibexecdir)/proximity-helper\"

proximity_helper_SOURCES = modules/bluetooth/proximity-helper.c
proximity_helper_LDADD = $(AM_LDADD) $(BLUEZ_LIBS)
proximity_helper_CFLAGS = $(AM_CFLAGS) $(BLUEZ_CFLAGS)
proximity_helper_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)

# Bluetooth sink / source
module_bluetooth_discover_la_SOURCES = modules/bluetooth/module-bluetooth-discover.c
module_bluetooth_discover_la_LDFLAGS = $(MODULE_LDFLAGS)
module_bluetooth_discover_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libbluetooth-util.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_bluetooth_discover_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)

libbluetooth_sbc_la_SOURCES = modules/bluetooth/sbc.c modules/bluetooth/sbc.h modules/bluetooth/sbc_tables.h modules/bluetooth/sbc_math.h modules/bluetooth/sbc_primitives.h modules/bluetooth/sbc_primitives.c modules/bluetooth/sbc_primitives_mmx.h modules/bluetooth/sbc_primitives_neon.h modules/bluetooth/sbc_primitives_mmx.c modules/bluetooth/sbc_primitives_neon.c
libbluetooth_sbc_la_LDFLAGS = -avoid-version
libbluetooth_sbc_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
libbluetooth_sbc_la_CFLAGS = $(AM_CFLAGS)
BLUETOOTH_SBC_FILES = $(subst modules/bluetooth/,,$(libbluetooth_sbc_la_SOURCES))

libbluetooth_ipc_la_SOURCES = modules/bluetooth/ipc.c modules/bluetooth/ipc.h
libbluetooth_ipc_la_LDFLAGS = -avoid-version
libbluetooth_ipc_la_LIBADD = $(AM_LIBADD)libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
libbluetooth_ipc_la_CFLAGS = $(AM_CFLAGS)
BLUETOOTH_IPC_FILES = $(subst modules/bluetooth/,,$(libbluetooth_ipc_la_SOURCES)) rtp.h

libbluetooth_util_la_SOURCES = modules/bluetooth/bluetooth-util.c modules/bluetooth/bluetooth-util.h
libbluetooth_util_la_LDFLAGS = -avoid-version
libbluetooth_util_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
libbluetooth_util_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)

module_bluetooth_device_la_SOURCES = modules/bluetooth/module-bluetooth-device.c modules/bluetooth/rtp.h
module_bluetooth_device_la_LDFLAGS = $(MODULE_LDFLAGS)
module_bluetooth_device_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libbluetooth-util.la libbluetooth-ipc.la libbluetooth-sbc.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_bluetooth_device_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)

# Apple Airtunes/RAOP
module_raop_sink_la_SOURCES = modules/raop/module-raop-sink.c
module_raop_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_raop_sink_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la librtp.la libraop.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la

module_raop_discover_la_SOURCES = modules/raop/module-raop-discover.c
module_raop_discover_la_LDFLAGS = $(MODULE_LDFLAGS)
module_raop_discover_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
module_raop_discover_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)

# Rygel
module_rygel_media_server_la_SOURCES = modules/module-rygel-media-server.c
module_rygel_media_server_la_LDFLAGS = $(MODULE_LDFLAGS)
module_rygel_media_server_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la libprotocol-http.la
module_rygel_media_server_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)

###################################
#        Some minor stuff         #
###################################

CLEANFILES = esdcompat client.conf default.pa system.pa daemon.conf start-pulseaudio-x11 start-pulseaudio-kde daemon/pulseaudio.desktop daemon/pulseaudio-kde.desktop

esdcompat: daemon/esdcompat.in Makefile
	sed -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
		-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
		-e 's,@PA_BINARY\@,$(PA_BINARY),g' < $< > $@
	chmod +x esdcompat

start-pulseaudio-x11: daemon/start-pulseaudio-x11.in Makefile
	sed -e 's,@PA_BINARY\@,$(PA_BINARY),g' \
		-e 's,@PACTL_BINARY\@,$(bindir)/pactl,g' < $< > $@
	chmod +x start-pulseaudio-x11

start-pulseaudio-kde: daemon/start-pulseaudio-kde.in Makefile
	sed -e 's,@PA_BINARY\@,$(PA_BINARY),g' \
		-e 's,@PACTL_BINARY\@,$(bindir)/pactl,g' < $< > $@
	chmod +x start-pulseaudio-kde

client.conf: pulse/client.conf.in Makefile
	sed -e 's,@PA_BINARY\@,$(PA_BINARY),g' < $< > $@

if OS_IS_WIN32
default.pa: daemon/default.pa.win32
	cp $< $@
system.pa: daemon/default.pa.win32
	cp $< $@
else
default.pa: daemon/default.pa.in Makefile
	sed -e 's,@PA_BINARY\@,$(PA_BINARY),g' \
            -e 's,@PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
	    -e 's,@PA_SOEXT\@,.so,g' < $< > $@
system.pa: daemon/system.pa.in Makefile
	sed -e 's,@PA_BINARY\@,$(PA_BINARY),g' \
            -e 's,@PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
	    -e 's,@PA_SOEXT\@,.so,g' < $< > $@
endif

daemon.conf: daemon/daemon.conf.in Makefile
	sed -e 's,@PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
		-e 's,@PA_DEFAULT_CONFIG_FILE\@,$(DEFAULT_CONFIG_DIR),g' < $< > $@

install-exec-hook:
	-chown root $(DESTDIR)$(pulselibexecdir)/proximity-helper
	-chmod u+s $(DESTDIR)$(pulselibexecdir)/proximity-helper
	ln -sf pacat $(DESTDIR)$(bindir)/parec
	ln -sf pacat $(DESTDIR)$(bindir)/pamon
	ln -sf pacat $(DESTDIR)$(bindir)/paplay
	ln -sf pacat $(DESTDIR)$(bindir)/parecord
	rm -f $(DESTDIR)$(libdir)/libpulsedsp.la
	rm -f $(DESTDIR)$(modlibexecdir)/*.la

uninstall-hook:
	rm -f $(DESTDIR)$(bindir)/parec
	rm -f $(DESTDIR)$(bindir)/pamon
	rm -f $(DESTDIR)$(bindir)/paplay
	rm -f $(DESTDIR)$(bindir)/parecord
	rm -f $(DESTDIR)$(libdir)/libpulsedsp.*
	rm -f $(DESTDIR)$(modlibexecdir)/*.so

massif: pulseaudio
	libtool --mode=execute valgrind --tool=massif --depth=6  --alloc-fn=pa_xmalloc --alloc-fn=pa_xmalloc0 --alloc-fn=pa_xrealloc --alloc-fn=dbus_realloc --alloc-fn=pa_xnew0_internal --alloc-fn=pa_xnew_internal ./pulseaudio

update-ffmpeg:
	wget -O pulsecore/ffmpeg/resample2.c http://svn.mplayerhq.hu/ffmpeg/trunk/libavcodec/resample2.c?view=co

# We get things twice here, because sometimes gitweb will us just give a "Generating..." otherwise.
update-sbc:
	for i in $(BLUETOOTH_SBC_FILES) ; do \
		wget -O /dev/null http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=sbc/$$i ; \
		wget -O modules/bluetooth/$$i http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=sbc/$$i ; \
	done
	for i in $(BLUETOOTH_IPC_FILES); do \
		wget -O /dev/null http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=audio/$$i ; \
		wget -O modules/bluetooth/$$i http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=audio/$$i ; \
	done

update-reserve:
	for i in reserve.c reserve.h reserve-monitor.c reserve-monitor.h ; do \
		wget -O modules/$$i http://git.0pointer.de/\?p=reserve.git\;a=blob_plain\;f=$$i\;hb=master ; \
	done

update-rtkit:
	for i in rtkit.c rtkit.h ; do \
		wget -O pulsecore/$$i http://git.0pointer.de/\?p=rtkit.git\;a=blob_plain\;f=$$i\;hb=master ; \
	done

# Automatically generate linker version script. We use the same one for all public .sos
update-map-file:
	( echo "PULSE_0 {" ; \
	  echo "global:" ; \
	  ctags -I PA_GCC_MALLOC,PA_GCC_ALLOC_SIZE2,PA_GCC_ALLOC_SIZE,PA_GCC_PURE,PA_GCC_CONST,PA_GCC_DEPRECATED,PA_GCC_PRINTF_ATTR -f - --c-kinds=p $(pulseinclude_HEADERS) | awk '/^pa_/ { print $$1 ";" }' | sort ; \
	  echo "local:" ;  \
	  echo "*;" ; \
	  echo "};" ) > $(srcdir)/map-file

update-all: update-ffmpeg update-sbc update-map-file

.PHONY: utils/padsp massif update-all update-ffmpeg update-sbc update-map-file
